//------------------------------------------------------------------------
//
//	CCGameBox is a game development library for iPhone and iPod Touch.
//
//	Licensed under the BSD license, see LICENSE in root for details.
// 
//	Copyright (c) 2009 James Hui (a.k.a. Dr.Watson)
// 
//	For latest updates, please visit http://www.cocoachina.com
//
//------------------------------------------------------------------------

#ifndef _GAMEAPP_H_
#define _GAMEAPP_H_
#include <string>
using namespace std;

class GameApp
{
public:
	int mKills;
	int mHealth;
	
	GameApp();
	~GameApp();
	
	void Update(float dt);
	void Render();
	
	void TouchesBegan(float x,float y);
	void TouchesMoved(float x,float y);
	void TouchesEnded(float x,float y);
	
	void BeginLayout();

private:
	float mAngle;
	float mScale;
	
	bool _gameBegin;
	bool _beginRender;
	
	////////////////////////////////
	//Texture and Image
	///////////////////////////////
	CCTexture	*_tBg;
	CCImage		*_bg;
	
	CCTexture	*_tCity;
	CCImage		*_city;
	
	CCTexture	*_tClouds;
	CCImage		*_clouds[2];
	
	CCTexture	*_tCrowdB;
	CCImage		*_crowdB;
	CCTexture	*_tCrowdM;
	CCImage		*_crowdM;
	CCTexture	*_tCrowdF;
	CCImage		*_crowdF[2];
	
	CCTexture	*_tGrey;
	CCImage		*_grey[5];
	
	CCTexture	*_tGreen;
	CCImage		*_green[5];
	
	CCTexture	*_tYellow;
	CCImage		*_yellow[5];
	
	CCTexture	*_tMale;
	CCImage		*_male[4];
	
	CCTexture	*_tFemale;
	CCImage		*_female[4];
	
	CCTexture	*_tExpolosion1;
	CCTexture	*_tExpolosion2;
	CCTexture	*_tExpolosion3;
	CCImage		*_expolosion[3];
	
	
	////////////////////////////////
	//texture moving
	///////////////////////////////
	int _clouds1Move;
	int _clouds2Move;
	bool _clouds1CanMove;
	bool _clouds2CanMove;
	/*
	 1 begin at 0
	 2 begin at 480 and at head
	 3 begin at 480 and at back
	 */
	int _clouds1Mode;
	int _clouds2Mode;
	
	/*
	 render image 1 2 3 4 5 6...
	 */
	short _crowdRender;
	short _zombieRender;
	
	short _zombieStatus;
	
	////////////////////////////////
	//timer control
	///////////////////////////////
	timeval _clouds_t;
	timeval _crowd_t;
	timeval _begin_t;
	timeval _zombie_t;
	timeval _zombieAppear_t;
	
	///////////////////////////////////
	//cal if the point is in the rect
	//////////////////////////////////
	bool PointInRect(float pX, float pY, 
					float minX,float minY,
					float maxX,float maxY);	
	//////////////////////////////////
	//sprites animation
	/////////////////////////////////
	//void CloudsAnimation(const double diff_t, const timeval now_t);
//	void CrowdAnimation(const double diff_t,const timeval now_t);
//	void ZombieAnimation(const double diff_t1, const double diff_t2,const timeval now_t);
//	void RemoveFromValidrectAtIndex(int index);
//	void CreateZombie(int count,short type);
//	short ZombieTypeByName(string zombieName);
//	bool ZombiePosIsOK(int x,int y);
};

#endif
